import 'package:flutter/material.dart';
import './ListViewHelp.dart';

class Page extends StatelessWidget {
  List<Tab> _Tabs = <Tab>[
    new Tab(text: '全部'),
    new Tab(text: '待付款'),
    new Tab(text: '待收货'),
    new Tab(text: '已完成'),
    new Tab(text: '已取消'),
  ];

  @override
  Widget build(BuildContext context) {
    return new DefaultTabController(
      length: _Tabs.length,
      child: new Scaffold(
        appBar: new AppBar(
          leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: () {}),
          title: Text("我的订单"),
          bottom: new TabBar(
            tabs: _Tabs,
            isScrollable: true,
          ),
        ),
        body: new TabBarView(
          children: _Tabs.map((Tab tab) {
            return new Center(
                child: new ListView.builder(
              itemCount: 2, //count 数值设置
              itemBuilder: (BuildContext context, int index) {
                //todo 不同页面返回不同类型的Item
                return buildItem(context, index); //ListViewHelp
              },
            ));
          }).toList(),
        ),
      ),
    );
  }
}
